﻿using System;
using System.Windows.Forms;

namespace 售后客户管理
{
    public partial class ComboboxMultipleSelection : UserControl
    {
        public ComboboxMultipleSelection()
        {
            InitializeComponent();
            this.SizeChanged += ComboboxMultipleSelection_SizeChanged;
            this.FontChanged += ComboboxMultipleSelection_FontChanged;
            this.TextChanged += Text_TextChanged;
        }

        private void Text_TextChanged(object sender, EventArgs e)
        {
            this.checkBoxComboBox1.Text = this.Text;
        }

        private void ComboboxMultipleSelection_FontChanged(object sender, EventArgs e)
        {
            this.Width = this.label1.Width + this.checkBoxComboBox1.Width + Convert.ToInt32(this.Font.Size) + 6;
            this.Height = this.checkBoxComboBox1.Height + 6;
        }

        private void ComboboxMultipleSelection_SizeChanged(object sender, EventArgs e)
        {
            this.checkBoxComboBox1.Width = this.Width - this.label1.Width - Convert.ToInt32(this.Font.Size) - 6;
        }

        private void CheckBoxComboBox1_TextChanged(object sender, EventArgs e)
        {
            this.Text = this.checkBoxComboBox1.Text;
        }
        public object DataSource
        {
            get { return this.checkBoxComboBox1.DataSource; }
            set { this.checkBoxComboBox1.DataSource = value; }
        }
        public string DisplayMemberSingleItem
        {
            get { return this.checkBoxComboBox1.DisplayMemberSingleItem; }
            set { this.checkBoxComboBox1.DisplayMemberSingleItem = value; }
        }
        public string DisplayMember
        {
            get { return this.checkBoxComboBox1.DisplayMember; }
            set { this.checkBoxComboBox1.DisplayMember = value; }
        }
        public string ValueMember
        {
            get { return this.checkBoxComboBox1.ValueMember; }
            set { this.checkBoxComboBox1.ValueMember = value; }
        }
        public string NameText
        {
            get { return this.label1.Text; }
            set { this.label1.Text = value; }
        }
        public PresentationControls.CheckBoxComboBoxItemList CheckBoxItems
        {
            get { return this.checkBoxComboBox1.CheckBoxItems; }
            set
            {
                this.checkBoxComboBox1.CheckBoxItems.Clear();
                this.checkBoxComboBox1.CheckBoxItems.AddRange(value);
            }
        }
        public ComboBox.ObjectCollection Items
        {
            get { return this.checkBoxComboBox1.Items; }
        }
        public bool ThreeState
        {
            get { return this.checkBoxComboBox1.CheckBoxProperties.ThreeState; }
            set { this.checkBoxComboBox1.CheckBoxProperties.ThreeState = value; }
        }
    }
}
